package com.mytest;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

import com.mytest.retrofit.RetrofitActivity;
import com.mytest.xjj.XJJHomeActivity;

import butterknife.ButterKnife;
import butterknife.OnClick;

public class MainActivity extends Activity {

    @OnClick(R.id.btn_keyboard)
    void keyboard() {
        startActivity(new Intent(this, KeyboardActivity.class));
    }

    @OnClick(R.id.btn_rxtest)
    void RxTest() {
        startActivity(new Intent(this, RxAndroidActivity.class));
    }

    @OnClick(R.id.btn_trans)
    void trans() {
        startActivity(new Intent(this, TransActivity.class));
    }

    @OnClick(R.id.btn_play)
    void playbtn() {
        startActivity(new Intent(this, PlayButtonActivity.class));
    }

    @OnClick(R.id.btn_retrofit)
    void retrofitbtn() {
        startActivity(new Intent(this, RetrofitActivity.class));
    }

    @OnClick(R.id.btn_smartrefresh)
    void smartrefresh() {
        startActivity(new Intent(this, XJJHomeActivity.class));
    }

    @OnClick(R.id.btn_weixin)
    void weixin() {
        Intent intent = new Intent();
        ComponentName cmp = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.LauncherUI");
        intent.setAction(Intent.ACTION_MAIN);
        intent.addCategory(Intent.CATEGORY_LAUNCHER);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.setComponent(cmp);
        startActivity(intent);
    }

    @OnClick(R.id.btn_browser)
    void browser() {
//        wxd930ea5d5a258f4f
//        wx86e24908b2a37776
        Uri uri = Uri.parse("weixin://dl/businessWebview/link?appid=wx7f8702c8d66c8856&url=http://wx.weixinxjj.com/help3/index.php?m=home&c=index&a=home&goods_id=15");
        Intent it = new Intent(Intent.ACTION_VIEW, uri);
        startActivity(it);
    }

    @OnClick(R.id.btn_scan)
    void scan() {
        //利用Intent打开微信
        Uri uri = Uri.parse("weixin://");
        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);

    }
}

